//
//  RW_UserSingleViewController.m
//  SleepApp
//
//  Created by chuangqi on 2021/3/30.
//  Copyright © 2021 RiceWang. All rights reserved.
//

#import "RW_UserSingleViewController.h"
#import "RW_UserSingleView.h"
#import "RW_LoginViewController.h"
@interface RW_UserSingleViewController ()
@property (nonatomic,strong) RW_UserSingleView *wlclass_view;
@end

@implementation RW_UserSingleViewController


- (void)initView{
    [self.contentView addSubview:self.wlclass_view];
    [self.wlclass_view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.insets(UIEdgeInsetsZero);
    }];
}
- (void)initData{
    [self.wlclass_view initData];
}
/** 子控制每次展示页面刷新数据 */
-(void)initReloadData{
    [self.wlclass_view initReloadData];
}
#pragma mark -- 父控制器功能
-(NSString *)set_title{
    return @"收藏夹";
}
-(UIButton *)set_leftButton{
    UIButton *button = [[UIButton alloc]init];
    [button setImage:[UIImage svgName:@"user_single_add"] forState:UIControlStateNormal];
    return button;
}
-(void)left_button_event:(UIButton *)sender{
    if ([UserModel_WL isLogin]){
        [self.wlclass_view click_add_single];
    } else {
        [RW_LoginViewController pushLoginFromVc:self];
    }
}

-(UIButton *)set_rightButton{
    UIButton *button = [[UIButton alloc]init];
    [button setTitle:@"编辑" forState:UIControlStateNormal];
    [button setTitleColor:UIColor.blackColor forState:UIControlStateNormal];
    button.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
    button.tag = 1;
    return button;
}
-(void)right_button_event:(UIButton *)sender{
    if (![UserModel_WL isLogin]){
        return;
    }
    if (sender.tag == 1){
        [self.wlclass_view songEditStatus:true];
        sender.tag = 2;
        [sender setTitle:@"取消" forState:UIControlStateNormal];
    } else {
        [self.wlclass_view songEditStatus:false];
        sender.tag = 1;
        [sender setTitle:@"编辑" forState:UIControlStateNormal];
    }
}

#pragma mark -- 懒加载
-(RW_UserSingleView *)wlclass_view{
    if (!_wlclass_view){
        _wlclass_view = [[RW_UserSingleView alloc]init];
    }
    return _wlclass_view;
}

@end
